<?php

namespace app\admin\service;

use app\admin\model\BoxYunCourse;
use app\admin\model\BoxYunGoods;

/**
 * 云挂机服务类
 */
class BoxYunCourseService extends BaseService
{
    /**
     * 构造函数
     */
    public function __construct()
    {
        $this->model = new BoxYunCourse();
    }


    public function getList(): array
    {
        $page  = request()->param('page', 1);
        $limit = request()->param('limit', 10);

        $list  = $this->model->where('mark', '=', 1)->order('sort', 'desc')->page($page, $limit)->select();
        //返回结果
        $count = $this->model->where('mark', '=', 1)->count();
        return array (
            "msg"   => '操作成功',
            "code"  => 0,
            "data"  => $list,
            "count" => $count,
        );
    }

    /**
     * 添加或编辑
     * @return mixed
     * @since 2021/6/9
     * @author ZhangXuanNeng
     */
    public function edit()
    {
        // 参数
        $data = request()->param();
        if(empty($data['id'])){
            $data['create_time'] = date('Y-m-d H:i:s');
        }
        return parent::edit($data); // TODO: Change the autogenerated stub
    }

    public function delete()
    {
        return parent::delete(); // TODO: Change the autogenerated stub
    }
}